<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1">
        <title> E8企业网站管理系统v2.4.0.0</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="/static/bk/css/style.css" rel="stylesheet" type="text/css" />
        <link href="/static/bk/css/layout.css" rel="stylesheet" type="text/css" />
        <script src="/static/bk/js/jquery.min.1.8.2.js" type="text/javascript"></script>
    </head>
    <body>
        <div id="main">
            <h1>E8企业网站管理系统v2.4.0.0</h1>
                <div class="login">
                    <ul>
                        <li class="liin var_box"><span>用户名</span><input name="txtAdminName" type="text" id="txtAdminName" class="input txt" /><b class="icon user"></b></li>
                        <li class="liin var_box"><span>密码</span><input name="txtAdminPass" type="password" id="txtAdminPass" class="input psw" /><b class="icon lock"></b></li>
                        <li class="var_box"><label class="liin varinput"><span>验证码</span><input name="txtVerifyCode" type="text" size="5" id="txtVerifyCode" class="input ver" /></label>
                            <label class="varimg"><img src="<?php echo b_url('rand_func/valcode');?>" id="ImgVerifyCode" title="点击刷新验证码" onclick="document.getElementById('ImgVerifyCode').src='<?php echo b_url('rand_func/valcode');?>?'+Math.random();" /></label></li>
                        <li>
                            <div id="UpdatePanel1">
                                <input type="submit" name="btnLogin" value="登 录" id="btnLogin" class="submit" />
                                <input type="reset" class="reset" value="重 置" />
                                <span id="errMsg" style="color:Red;"></span>
                            </div>
                        </li>
                    </ul>
                </div>
        </div>
    <script type="text/javascript">
        $(function () {
            $(".input").focus(function () {
                $(this).parent().find("span").hide();
            });
            $(".input").blur(function () {
                if ($(this).val() == "") {
                    $(this).parent().find("span").show();
                }
            });
            $(".input").parent().find("span").click(function () {
                $(this).hide();
                $(this).parent().find(".input").focus();
            });

            $(".input").parent().find("input").each(function () {
                if ($(this).val() == "") {
                    $(this).parent().find("span").show();
                }
                else {
                    $(this).parent().find("span").hide();
                }

            });

            $('#btnLogin').click(function () {
                var username = $('#txtAdminName').val();
                if(!username) {
                    $('#errMsg').text('请输入用户名');return;
                }
                var password = $('#txtAdminPass').val();
                if(!password) {
                    $('#errMsg').text('请输入密码');return;
                }
                var vericode = $('#txtVerifyCode').val();
                if(!vericode) {
                    //$('#errMsg').text('请输入验证码');return;
                }

                $.ajax({
                    type: "POST",
                    url: "/admin.php/login/checkLogin",
                    data: "txtAdminPass=" + escape(password) + "&txtAdminName=" + escape(username) + "&txtVerifyCode=" + escape(vericode),
                    beforeSend:
                    function () {
                    },
                    success:
                    function (data) {
                        if (data == 1) {
                            window.location.href = "/admin.php/main";
                        } else {
                            $('#errMsg').text(data);
                        }
                    }
                });
            });
        });
    </script>
    </body>
</html>
